	class LHGrid extends egret.Shape{



		public constructor() {
			super();

		}

		public fillColor(color) {
			this.graphics.clear();

			this.graphics.beginFill( color );
        	this.graphics.drawRect( 0, 0, this.width, this.height);
        	this.graphics.endFill();
		}
	}

	enum LHBrickType {
		All,
		NoTopLeft,
		NoTopRight,
		NoBottomLeft,
		NoBottomRight
	}

	enum LHBrickColorStyle {
		Red,
		blue
	}

	class LHBrick extends egret.Sprite {
		//四格
		pointArray: Array<number> = [0,0,0,0];
		
		itemArray: Array<LHGrid> = [];
		style: LHBrickType = LHBrickType.All;
		colorStyle: LHBrickColorStyle = LHBrickColorStyle.Red;
		itemXIndex: number = 0;
		itemYIndex: number = 0;

		public constructor() {
			super();
			var side = 100;
			var col = 2;
			var row = 2;

			this.width =  side * row;
			this.height = side * col;
			
			for (var i=0; i<this.pointArray.length; i++) {
				let view = new LHGrid();
				view.y = parseInt((i / row).toString()) * side;
				view.x = i % row * side;
				view.width = side;
				view.height = side;
				view.alpha = 0;

				view.fillColor(this.getViewCorlor());
				this.addChild(view);
				this.itemArray.push(view);
			}
		}

		public checkPointRight(array:Array<number>):boolean {
			for (var i=0; i<this.pointArray.length; i++) {
				let num1 = this.pointArray[i];
				let num2 = array[i];

				if (num1 == 1 && num2 == 1) {
					return false;
				}
			}
			
			return true;
		}

		private getViewCorlor():number {
			if (this.colorStyle == LHBrickColorStyle.Red) {
				return 0xff0000;
			} else if (this.colorStyle == LHBrickColorStyle.blue) {
				return 0x0000ff;
			}
			
			return 0xffffff;
		}

		public reloadColorStyle(style: LHBrickColorStyle) {
			this.colorStyle = style;

			for (var i=0; i<this.itemArray.length; i++) {
				let view: LHGrid = this.itemArray[i];
				view.fillColor(this.getViewCorlor());
			}
		}

		public reloadWithStyle(style:LHBrickType) {
			this.style = style;

			var arr:Array<number> = [1,1,1,1];
			if (style == LHBrickType.NoTopLeft) {
				arr = [0,1,1,1];
			} else if (style == LHBrickType.NoTopRight) {
				arr = [1,0,1,1];
			} else if (style == LHBrickType.NoBottomLeft) {
				arr = [1,1,0,1];
			} else if (style == LHBrickType.NoBottomRight) {
				arr = [1,1,1,0];
			}

			this.reloadPointArray(arr);
		}

		public reloadCo


		private reloadPointArray(array) {
			this.pointArray = array;
			this.reloadShow();
		}

		private reloadPintArray(x1, x2, y1, y2) {
			this.pointArray = [x1, x2, y1, y2];
			this.reloadShow();
		}

		private reloadShow() {
			for (var i=0; i<this.itemArray.length; i++) {
				let view = this.itemArray[i];
				let num = this.pointArray[i];
				view.alpha = num;
			}
		}
	}
